import sys
class Solution:
    def coinChange(self, coins, amount):
        """
        :type coins: List[int]
        :type amount: int
        :rtype: int
        """
        n = len(coins)
        f = [sys.maxsize] * (amount+1)
        f[0] = 0
        for i in range(1, amount+1):
            for j in range(n):
                if i >= coins[j]:
                    f[i] = min(f[i], f[i - coins[j]] + 1)
        if f[-1] == sys.maxsize:
            return -1
        return f[-1]


s = Solution()
m = s.coinChange([1,2,5],11)
print(m)